"use client";

import { Button, Space } from "antd";
import Link from "next/link";
import { useRouter } from "next/navigation";
import type { Course } from "@prisma/client";
import { EyeOutlined } from '@ant-design/icons';

interface CourseCardActionsProps {
  course: Course;
  onDelete: (course: Course) => Promise<void>;
}

export function CourseCardActions({ course, onDelete }: CourseCardActionsProps) {
  const router = useRouter();

  return (
    <Space>
      <Button 
        onClick={() => router.push(`/courses/${course.id}/edit`)}
        size="small"
      >
        编辑
      </Button>
      <Button 
        onClick={() => router.push(`/courses/${course.id}/tasks`)}
        size="small"
      >
        任务
      </Button>
      <Button 
        danger 
        onClick={() => onDelete(course)}
        size="small"
      >
        删除
      </Button>
      <Link href={`/courses/${course.id}/preview`}>
        <Button 
          icon={<EyeOutlined />}
          type="link"
          size="small"
        >
          预览
        </Button>
      </Link>
    </Space>
  );
} 